import { defineConfig } from 'vite'
// const {config} = require('')
import vue from '@vitejs/plugin-vue'
import{resolve} from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  base: './',  // 开发或生产环境服务的公共基础路径
  plugins: [vue()],
  resolve: {
    alias: {  // 配置路径别名
      '@': resolve('src')
    },
  },
  css: {
    preprocessorOptions: {   // css预处理器
      less: {
        // 引入全局的Less库，有关lib.less请看 → https://www.jianshu.com/p/b13e2a2204b2
        additionalData: '@import "./src/assets/less/lib.less";'
      },
    },
  }
  ,
  server: {
    cors: true, //默认启动并允许任何源
    port: 10000, //设置启动端口
    host: true,
    proxy: {
      "/api": {
        target: 'http://localhost:9090',
        // target: 'http://159.75.180.163:9090',
        changeOrigin: true,
        ws: true, //允许websocket代理
        rewrite: (path) => path.replace(/api/, '')
      }
    }
  }

})

